<script>
    $(document).ready(function() {
    $('#calendar').fullCalendar({  
        			header: {
                                    left: 'prev,next today',
                                    center: 'title',
                                    right: 'month,basicWeek,basicDay'
                                },
                                displayEventEnd: {
                                    month: true,
                                    basicWeek:true,
                                    basicDay:true,
                                    'default': true
                                },
                                eventClick: function(calEvent, jsEvent, view) {
                                    //redirect to the view.
                                    window.location.href='/room-plan/bookings/view/'+calEvent.id;
                                },
                                defaultView: 'basicWeek'        
    });
    $('#calendar').fullCalendar( 'addEventSource', "/room-plan/bookings/feed?room_id="+$('#room_id').val() );
});
</script>

<table>
    <tr>
        <td>
            <h2><?php echo __($room['Room']['name']); ?></h2>
            <?php echo 'Sitzplätze: '.$room['Room']['seats']; ?><br>
            <?php echo 'Beschreibung: '.$room['Room']['description']; ?>
        </td>
        <td>
             <?php
                 echo $this->Form->create('Booking',array('action' => 'add'));                 
                 echo $this->Form->hidden('room_id', array('type' => 'text', 'default' => $room['Room']['id']));                 
                 echo $this->Form->end(__('Buchen'));
             ?>            
        </td>
    </tr>
</table>

<h3><?php echo __('Ausstattung'); ?></h3>
<?php if (!empty($room['Feature'])): ?>
	<table cellpadding = "0" cellspacing = "0">
	<tr>
		<th><?php echo __('Id'); ?></th>
		<th><?php echo __('Name'); ?></th>
		<th><?php echo __('Descript'); ?></th>
	</tr>
	<?php foreach ($room['Feature'] as $feature): ?>
		<tr>
			<td><?php echo $feature['id']; ?></td>
			<td><?php echo $feature['name']; ?></td>
			<td><?php echo $feature['descript']; ?></td>
		</tr>
	<?php endforeach; ?>
	</table>
<?php endif; ?>
<h3>Belegung</h3>

<div id="calendar"></div>

<input type="text" id="room_id" value="<?php echo $room['Room']['id']; ?>" style="visibility:hidden">
 
